package model;

import ds.MySort;
import ds.MySearch;

public class Leaderboard {
    private int[] scores = new int[100]; // 假设最多100条记录
    private int size = 0;

    // 排序
    public void addScore(int score) {
        if (size < scores.length) {
            scores[size++] = score;
        }
        MySort.sort(scores, size); // 排序
    }

    // 查找
    public boolean contains(int score) {
        return MySearch.contains(scores, size, score);
    }

    public int[] getScores() {
        int[] arr = new int[size];
        System.arraycopy(scores, 0, arr, 0, size);
        return arr;
    }
} 